package create.singleton.singleton_demo1;

/**
 * 懒汉式线程不安全
 *
 * @author yeyangtao
 * @date 2020/5/19 17:38
 */
public class Single2 {
    private String name;
    private Integer age;

    private static Single2 instance;

    private Single2() {
    }

    public static Single2 getInstance() {
        if (instance == null) {
            instance = new Single2();
        }
        return instance;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
